package com.nuoniu.sibanyun.service.work.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.nuoniu.sibanyun.entity.work.WorkSummary;
import com.nuoniu.sibanyun.mapper.work.WorkSummaryMapper;
import com.nuoniu.sibanyun.service.work.IWorkSummaryService;
import com.nuoniu.sibanyun.userThread.UserInfo;
import com.nuoniu.sibanyun.userThread.UserThreadLocal;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 工作总结 服务实现类
 * </p>
 *
 * @author baiqiang
 * @since 2020-09-15
 */
@Service
public class WorkSummaryServiceImpl extends ServiceImpl<WorkSummaryMapper, WorkSummary> implements IWorkSummaryService {

    @Override
    public Page<WorkSummary> pageList(Page page, WorkSummary workSummary) {
        UserInfo userInfo = UserThreadLocal.get();
        if(workSummary.getTabKey() == 1) {
            workSummary.setCreateUserId(userInfo.getUserId());
        }else if(workSummary.getTabKey() == 2) {
            workSummary.setSubmitId(userInfo.getUserId());
        }else if(workSummary.getTabKey() == 3){
            workSummary.setCcId(userInfo.getUserId().toString());
        }
        return baseMapper.pageList(page, workSummary);
    }
}
